package com.arpa.oms.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;


/**
 * @description 销售单类型：NORMAL普通销售
 *
 * @author leo
 * @date 2020/10/09
 **/
public enum SaleTypeEnum implements IEnum<String> {
    // 采购单类型
    NORMAL("NORMAL","普通销售"),
    FROM_PDD("PDD", "拼多多订单"),
    FROM_DY("FROM_DY", "抖音订单"),
    FROM_JD("FROM_JD", "京东订单"),
    FROM_CAINIAO("FROM_CAINIAO", "菜鸟订单"),
    FROM_KS("FROM_KS", "快手订单"),
    FROM_TB("TB", "淘宝订单"),
        ;

    /**
     * 值
     */
    @EnumValue
    private final String value;

    /**
     * 描述
     */
    private final String desc;

    SaleTypeEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    private static final Map<String, SaleTypeEnum> map = new HashMap();

    static {
        SaleTypeEnum[] values = values();
        int length = values.length;
        for(int i = 0; i < length; i++){
            SaleTypeEnum value1 = values[i];
            map.put(value1.getValue(),value1);
        }
    }

    public static SaleTypeEnum getEnumByValue(String value){

        return map.get(value);
    }
    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return this.desc;
    }
}
